package com.yicun.utils;

public class StringUtils {

    public static String formatCapital(String capital) {
        try {
            double amount = Double.parseDouble(capital);
            if (amount >= 10000) {
                return String.format("%.1f", amount / 10000);
            } else {
                return capital;
            }
        } catch (NumberFormatException e) {
            return capital;
        }
    }

    public static String abbreviate(String text, int maxLength) {
        if (text == null || text.length() <= maxLength) {
            return text;
        }
        return text.substring(0, maxLength) + "...";
    }
}
